<?php
/*
 * 接口：/flow_approval/delete
 * 说明：删除审核流程
 */

//关闭事物自动提交
$db->mysqlDB->falseAutoCommit();

//获取请求参数
$params = $route->bodyParams;


//删除审核流
$P1 = array(
  "update_where" => 'ofa_id',
  "ofa_id" => $params['ofa_id'],
  "ofa_is_delete" => 1
);
$R1 = $db->mysqlDB->automaticUpdate($P1)->update("easyd_oa_flow_approval");

//删除该审核流下的所有节点关联用户
$P2 = array(
  "update_where" => 'ofam_ofid,ofam_ofaid',
  "ofam_ofid" => $params['of_id'],
  "ofam_ofaid" => $params['ofa_id'],
  "ofam_is_delete" => 1
);

$R2 = $db->mysqlDB->automaticUpdate($P2)->update("easyd_oa_flow_approval_middle");

//判断是否有出错
if(!$R1 || !$R2){
  $db->mysqlDB->rollBackCommint();
  $db->mysqlDB->trueAutoCommit();
  $response->responseData(false);
}else{
  $db->mysqlDB->actionCommint();
  $db->mysqlDB->trueAutoCommit();
  $response->responseData(true);
}
?>